<template>
	<view class="con_1">
		<view class="width_90">
			<view class="drawBox">
				<view class="top ft_14">当前大潜兑换池</view>
				<view class="topMoney ft_32 fw-b">{{info.can_jf}}</view>
			</view>
			<view class="ft_18 fw-b" style="color: #33312E;margin-bottom: 20rpx;">输入兑换</view>
			<!-- <view class="middle ft_12">100红包券=1现金</view> -->
			<view class="tiMoney ft_14">
				<input type="text" value="" v-model="money" placeholder="输入兑换的大潜额度"/>
			</view>
			<view>当前大潜单价：{{info.jf_money}}</view>
			<view>您的小潜余额：{{info.money}}</view>
		</view>
		
		
		<view class="btn" @tap="submit">确认提交</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				money:'',
				info:{}
			}
		},
		onShow() {
			this.getInfo()
		},
		methods: {
			getInfo(){
				this.$myRequest({
					url: 'api/user/get_jf_info',
					method:'POST',
				}).then(res => {
					console.log(res.data);
					if(res.data.code==1){
						let data=res.data.data
						this.info = data
					}
				})
			},
			submit(){
				this.$myRequest({
					url: 'api/user/user_buy_jf',
					method:'POST',
					data:{
						num:this.money,
						type:1
					}
				}).then(res => {
					console.log(res.data);
					if(res.data.code==1){
						setTimeout(function() {
							uni.navigateBack({
								data:1
							})
						}, 1000);
					}
					uni.showToast({
						icon:'none',
						title:res.data.msg
					})
				})
			},
		}
	}
</script>

<style lang="scss">
page{background-color: #FAFAFA;}
// .con_1{
// 	width: 90%;margin: auto;
// }
.drawBox{
	margin: 40rpx 0;
	background-color: #fff;
	text-align: center;
	height: 270rpx;
	.top{
		padding-top: 60rpx;
		color: #666666;
		margin-bottom: 38rpx;
	}
}
.middle{
	margin: 18rpx 0;
	color: #333;
}
.tiMoney{
	height: 110rpx;
	line-height: 110rpx;
	text-align: center;
	background: #FFFFFF;
	border-radius: 16rpx;
	border: 2rpx solid #E6E6E6;
	color: #999;
	input{
		height: 110rpx;
		line-height: 110rpx;
	}
}
.btn{
	width: 90%;
	margin:40rpx auto 0 auto;
	height: 100rpx;
	line-height: 100rpx;
	text-align: center;
	background: #FF9101;
	color: #FFFFFF;
	border-radius: 50rpx;
}
.topName{
	font-size: 18px;
	font-weight: bold;
	color: #33312E;
	margin: 40rpx auto 24rpx auto;
}
.bankDetail{
	background-color: #fff;
	.alipay{
		border-bottom: 1px solid #eeeeee;
		padding: 10px 0;
		width: 90%;margin:auto;
	}
}
</style>
